Optimal. Leaf size=137 \[ a^3 A x+\frac {\left (6 a^2 A b+A b^3+2 a^3 B+3 a b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b \left (9 a A b+8 a^2 B+2 b^2 B\right ) \tan (c+d x)}{3 d}+\frac {b^2 (3 A b+5 a B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b B (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 137, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {4003, 4133,
3855, 3852, 8} \begin {gather*} a^3 A x+\frac {b \left (8 a^2 B+9 a A b+2 b^2 B\right ) \tan (c+d x)}{3 d}+\frac {\left (2 a^3 B+6 a^2 A b+3 a b^2 B+A b^3\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^2 (5 a B+3 A b) \tan (c+d x) \sec (c+d x)}{6 d}+\frac {b B \tan (c+d x) (a+b \sec (c+d x))^2}{3 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 4003
Rule 4133
Rubi steps
\begin {align*} \int (a+b \sec (c+d x))^3 (A+B \sec (c+d x)) \, dx &=\frac {b B (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{3} \int (a+b \sec (c+d x)) \left (3 a^2 A+\left (6 a A b+3 a^2 B+2 b^2 B\right ) \sec (c+d x)+b (3 A b+5 a B) \sec ^2(c+d x)\right ) \, dx\\ &=\frac {b^2 (3 A b+5 a B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b B (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{6} \int \left (6 a^3 A+3 \left (6 a^2 A b+A b^3+2 a^3 B+3 a b^2 B\right ) \sec (c+d x)+2 b \left (9 a A b+8 a^2 B+2 b^2 B\right ) \sec ^2(c+d x)\right ) \, dx\\ &=a^3 A x+\frac {b^2 (3 A b+5 a B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b B (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{3} \left (b \left (9 a A b+8 a^2 B+2 b^2 B\right )\right ) \int \sec ^2(c+d x) \, dx+\frac {1}{2} \left (6 a^2 A b+A b^3+2 a^3 B+3 a b^2 B\right ) \int \sec (c+d x) \, dx\\ &=a^3 A x+\frac {\left (6 a^2 A b+A b^3+2 a^3 B+3 a b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^2 (3 A b+5 a B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b B (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}-\frac {\left (b \left (9 a A b+8 a^2 B+2 b^2 B\right )\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 d}\\ &=a^3 A x+\frac {\left (6 a^2 A b+A b^3+2 a^3 B+3 a b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b \left (9 a A b+8 a^2 B+2 b^2 B\right ) \tan (c+d x)}{3 d}+\frac {b^2 (3 A b+5 a B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b B (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.61, size = 108, normalized size = 0.79 \begin {gather*} \frac {6 a^3 A d x+3 \left (6 a^2 A b+A b^3+2 a^3 B+3 a b^2 B\right ) \tanh ^{-1}(\sin (c+d x))+3 b \left (6 a A b+6 a^2 B+2 b^2 B+b (A b+3 a B) \sec (c+d x)\right ) \tan (c+d x)+2 b^3 B \tan ^3(c+d x)}{6 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.36, size = 180, normalized size = 1.31
method | result | size |
derivativedivides | \(\frac {A \,a^{3} \left (d x +c \right )+a^{3} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+3 A \,a^{2} b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+3 B b \,a^{2} \tan \left (d x +c \right )+3 A \,b^{2} a \tan \left (d x +c \right )+3 B a \,b^{2} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+A \,b^{3} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )-B \,b^{3} \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )}{d}\) | \(180\) |
default | \(\frac {A \,a^{3} \left (d x +c \right )+a^{3} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+3 A \,a^{2} b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+3 B b \,a^{2} \tan \left (d x +c \right )+3 A \,b^{2} a \tan \left (d x +c \right )+3 B a \,b^{2} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+A \,b^{3} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )-B \,b^{3} \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )}{d}\) | \(180\) |
norman | \(\frac {a^{3} A x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-a^{3} A x +3 a^{3} A x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-3 a^{3} A x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {4 b \left (9 A b a +9 a^{2} B +b^{2} B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {b \left (6 A b a -A \,b^{2}+6 a^{2} B -3 B a b +2 b^{2} B \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {b \left (6 A b a +A \,b^{2}+6 a^{2} B +3 B a b +2 b^{2} B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}-\frac {\left (6 A \,a^{2} b +A \,b^{3}+2 a^{3} B +3 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {\left (6 A \,a^{2} b +A \,b^{3}+2 a^{3} B +3 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) | \(288\) |
risch | \(a^{3} A x -\frac {i b \left (3 A \,b^{2} {\mathrm e}^{5 i \left (d x +c \right )}+9 B a b \,{\mathrm e}^{5 i \left (d x +c \right )}-18 A a b \,{\mathrm e}^{4 i \left (d x +c \right )}-18 B \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-36 A a b \,{\mathrm e}^{2 i \left (d x +c \right )}-36 B \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-12 B \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-3 A \,b^{2} {\mathrm e}^{i \left (d x +c \right )}-9 B a b \,{\mathrm e}^{i \left (d x +c \right )}-18 A b a -18 a^{2} B -4 b^{2} B \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,a^{2} b}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,b^{3}}{2 d}+\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B a \,b^{2}}{2 d}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,a^{2} b}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,b^{3}}{2 d}-\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{d}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B a \,b^{2}}{2 d}\) | \(356\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.27, size = 202, normalized size = 1.47 \begin {gather*} \frac {12 \, {\left (d x + c\right )} A a^{3} + 4 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} B b^{3} - 9 \, B a b^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 3 \, A b^{3} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 12 \, B a^{3} \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + 36 \, A a^{2} b \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + 36 \, B a^{2} b \tan \left (d x + c\right ) + 36 \, A a b^{2} \tan \left (d x + c\right )}{12 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 5.16, size = 189, normalized size = 1.38 \begin {gather*} \frac {12 \, A a^{3} d x \cos \left (d x + c\right )^{3} + 3 \, {\left (2 \, B a^{3} + 6 \, A a^{2} b + 3 \, B a b^{2} + A b^{3}\right )} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (2 \, B a^{3} + 6 \, A a^{2} b + 3 \, B a b^{2} + A b^{3}\right )} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (2 \, B b^{3} + 2 \, {\left (9 \, B a^{2} b + 9 \, A a b^{2} + 2 \, B b^{3}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (3 \, B a b^{2} + A b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{12 \, d \cos \left (d x + c\right )^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (A + B \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{3}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 336 vs.
\(2 (129) = 258\).
time = 0.51, size = 336, normalized size = 2.45 \begin {gather*} \frac {6 \, {\left (d x + c\right )} A a^{3} + 3 \, {\left (2 \, B a^{3} + 6 \, A a^{2} b + 3 \, B a b^{2} + A b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (2 \, B a^{3} + 6 \, A a^{2} b + 3 \, B a b^{2} + A b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (18 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 18 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 9 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 36 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 36 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 18 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 18 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 9 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.03, size = 526, normalized size = 3.84 \begin {gather*} \frac {\frac {A\,b^3\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {B\,b^3\,\sin \left (3\,c+3\,d\,x\right )}{6}+\frac {B\,b^3\,\sin \left (c+d\,x\right )}{2}+\frac {3\,A\,a\,b^2\,\sin \left (c+d\,x\right )}{4}+\frac {3\,B\,a^2\,b\,\sin \left (c+d\,x\right )}{4}+\frac {3\,A\,a^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}-\frac {A\,b^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{4}-\frac {B\,a^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{2}+\frac {3\,A\,a\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{4}+\frac {3\,B\,a\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {3\,B\,a^2\,b\,\sin \left (3\,c+3\,d\,x\right )}{4}+\frac {A\,a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {A\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}}{4}-\frac {B\,a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}}{2}-\frac {A\,a^2\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,3{}\mathrm {i}}{2}-\frac {B\,a\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,3{}\mathrm {i}}{4}-\frac {A\,a^2\,b\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,9{}\mathrm {i}}{2}-\frac {B\,a\,b^2\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,9{}\mathrm {i}}{4}}{d\,\left (\frac {3\,\cos \left (c+d\,x\right )}{4}+\frac {\cos \left (3\,c+3\,d\,x\right )}{4}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________